package com.zycx.common.page;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Description:  分页工具
 * Created by zycx on 2018-12-10 22:14
 * Created with IntelliJ IDEA.
 */
public class QueryPage extends LinkedHashMap<String, Object> {
    //当前页码
    private int page = 1;
    //每页条数
    private int limit = 10;

    public QueryPage(Map<String, Object> params) {
        this.putAll(params);
        //分页参数
        if (params.get("page") != null) {
            this.page = Integer.parseInt(params.get("page").toString());
        }
        if (params.get("limit") != null) {
            this.limit = Integer.parseInt(params.get("limit").toString());
        }
        this.remove("page");
        this.remove("limit");
    }


    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }
}
